import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:smart_ai_dart/pages/home_page/index.dart';
import 'package:smart_ai_dart/pages/main_page/controller.dart';
import 'package:smart_ai_dart/pages/profile_page/index.dart';

class MainPage extends GetView<MainController> {
  const MainPage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Obx(() => IndexedStack(
            index: controller.currentIndex.value,
            children: const [
              HomePage(),
              ProfilePage(),
            ],
          )),
      bottomNavigationBar: Obx(
        () => BottomNavigationBar(
          onTap: controller.changePage,
          currentIndex: controller.currentIndex.value,
          items: [
            BottomNavigationBarItem(
              icon: const Icon(Icons.home),
              label: 'home'.tr,
            ),
            BottomNavigationBarItem(
              icon: const Icon(Icons.person),
              label: 'profile'.tr,
            ),
          ],
        ),
      ),
    );
  }
}
